<?php
error_reporting("E_ALL");ini_set("display_errors", 1);
$getdata=$_REQUEST;
if(empty($getdata))$getdata=$_POST?$_POST:$_GET;
$type=empty($getdata['type'])?'':$getdata['type'];
include("include/function.php");
//header("content-Type: application/json; charset=utf-8");
$config = include("config.php");
include("include/".$config['DB_TYPE'].".class.php");
$db = new db;
$db->connect($config['DB_HOST'],$config['DB_USER'],$config['DB_PWD'],$config['DB_NAME'], $config['DB_PCONNECT']);
      
$page = empty($getdata['page'])?1:$getdata['page'];
$id = empty($getdata['id'])?0:$getdata['id'];
$title=['id','名称','学校','班级','班级昵称','电话','status','is_delete'];
$result[]=implode(',',$title);
$list = file('s.txt');
foreach($list as $vo){
        $ssql = "select * from order_info where batchNum='202502' and studentName='".trim($vo)."';";
        $res = $db->query($ssql);
        if(empty($res)){
            $ssql = "select * from order_info_hs where batchNum='202502' and studentName='".trim($vo)."';";
            $res = $db->query($ssql);
        }
        if(!empty($res)){$insert++;
            foreach($res as $v){
                $item=array(
                    $v['studentUuid'],
                    $v['studentName'],
                    $v['unitName'],
                    $v['className'],
                    $v['parName'],
                    $v['buyerMobile'],
                    $v['buyerName'],
                    '',
                );
			$result[]=implode(',',$item);
            }
        }
}
		echo implode("\n",$result);
$log = $id.'导入成功,：'.$insert.'条';
//echo $log.'<script>location.href="?page='.$page.'&id='.$id.'";</script>';

//echo count($sqlarr)."\n";
//echo implode(";\n",$sqlarr);
?>